; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=jump-threading %s | FileCheck %s

; https://github.com/llvm/llvm-project/issues/58812

define void @test() {
; CHECK-LABEL: @test(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    br label [[EXIT:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    [[DUMMY:%.*]] = phi i16 [ 0, [[LOOP:%.*]] ]
; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i16 0, 1
; CHECK-NEXT:    [[XOR:%.*]] = xor i1 false, [[XOR]]
; CHECK-NEXT:    br i1 [[XOR]], label [[LOOP]], label [[EXIT]]
; CHECK:       exit:
; CHECK-NEXT:    ret void
;
entry:
  br i1 false, label %loop, label %exit

loop:
  %bool = phi i1 [ %xor, %loop.latch ], [ false, %entry ]
  %cmp = icmp eq i16 0, 1
  %xor = xor i1 %cmp, %bool
  br i1 %bool, label %loop.latch, label %exit

loop.latch:
  %dummy = phi i16 [ 0, %loop ]
  br label %loop

exit:
  ret void
}
